package icasue.tools.sqlhelper.core.providers;

import icasue.reflect.annotations.NotNull;
import icasue.tools.sqlhelper.common.FieldsTouch;
import icasue.tools.sqlhelper.core.Consult;

/**
 * @Author: Qiao Hang
 * @CreateDate: 2021/11/19 上午10:22
 * @UpdateDate:
 * @Description: 
 */
public interface FieldRowsSqlProvider<JavaType extends Object> {

    /**
     * 查询数据库映射的某一属性，返回一行记录.
     * @param touch
     * @return
     */
    String fieldRow(@NotNull FieldsTouch<JavaType, ?> touch) throws Throwable;

    /**
     * 查询数据库映射的某一属性，返回多行记录.
     * @param touch
     * @return
     * @throws Throwable
     */
    String fieldRows(@NotNull FieldsTouch<JavaType, ?> touch) throws Throwable;

    /**
     * 根据JavaType映射非null列匹配查询数据库映射的某一属性，返回一行记录.
     * @param inst
     * @param touch
     * @return
     * @throws Throwable
     */
    String fieldRowSmart(@NotNull JavaType inst, @NotNull FieldsTouch<JavaType, ?> touch) throws Throwable;

    /**
     * 根据JavaType映射非null列匹配查询数据库映射的某一属性，返回多行记录.
     * @param inst
     * @param touch
     * @return
     * @throws Throwable
     */
    String fieldRowsSmart(@NotNull JavaType inst, @NotNull FieldsTouch<JavaType, ?> touch) throws Throwable;

    /**
     * 根据Consult描述的条件序列查询数据库映射的某一属性，返回一行记录.
     * @param consult
     * @param touch
     * @return
     * @throws Throwable
     */
    String fieldRowByConsult(@NotNull Consult<JavaType> consult, @NotNull FieldsTouch<JavaType, ?> touch) throws Throwable;

    /**
     * 根据Consult描述的条件序列查询数据库映射的某一属性，返回多行记录.
     * @param consult
     * @param touch
     * @return
     * @throws Throwable
     */
    String fieldRowsByConsult(@NotNull Consult<JavaType> consult, @NotNull FieldsTouch<JavaType, ?> touch) throws Throwable;
}
